<template>
    <uni-list>
        <uni-list-item title="头像" clickable showArrow @click="onClick('头像', 'tx')">
            <template #footer>
                <data-image v-model="userInfo.tx" />
            </template>
        </uni-list-item>
        <uni-list-item title="昵称" :rightText="userInfo.yhxm" clickable showArrow @click="onClick('昵称', 'yhxm')" />
        <uni-list-item title="联系电话" :rightText="userInfo.lxdh" clickable showArrow @click="onClick('联系电话', 'lxdh')" />
        <uni-list-item title="所属机构" :rightText="userInfo.jgxx.jgmc" />
        <uni-list-item title="用户密码" clickable showArrow @click="onClick('用户密码', 'yhmm')" />
        <uni-list-item title="用户邮箱" :rightText="userInfo.yhyx" clickable showArrow @click="onClick('用户邮箱', 'yhyx')" />
        <uni-list-item title="联系地址" :rightText="userInfo.lxdz" clickable showArrow @click="onClick('联系地址', 'lxdz')" />


    </uni-list>
</template>

<script setup lang="ts">
import { useUserStore } from "@/stores/modules/user";
import { ref, watch } from "vue";
const userInfo = ref(useUserStore().getUser)
console.log(userInfo.value)

watch(() => useUserStore().getUser, (newValue) => {
    if (newValue) {
        userInfo.value = newValue
        console.log(userInfo)
    }
})

const onClick = (title: string, key: string) => {
    uni.navigateTo({ url: `/pages/my/view/edit?title=${title}&key=${key}` })

}

</script>

<style lang="scss" scoped>
::v-deep .uni-list-item__container {
    align-items: center;
}
</style>
